<div class="form">
<?php
    echo CHtml::form('index.php?r=updateQuarterAmount','post', array('id'=>'monthly-form'));
    echo '<br/>';
    if($contract->canCreateFirstScheduleInvoice()){
        echo CHtml::link('Create First Invoice', 'javascript:void(0)', array('onclick'=>'createFirstScheduleInvoice()'));
    }
    $date = explode('-',$contract->contractstartdate);
    $start_month =intval( $date[1]);

    for($i=1;$i<=12;$i++){
        $model=  ContractSchedule::model()->find('number=:number AND contractid=:contractid AND billtype=:billtype',array(
            'number'=>$i,
            'contractid'=>$contract->contractid,
            'billtype'=>$contract->billtype
        ));
        $counter = $i+$start_month;
        $disabled='';
        if($model!=NULL && $model->isInvoiceForScheduleContractCreated()){
            $disabled='disabled';
        }
        echo "<div class='row'>";
        echo CHtml::label(date('F',  mktime(0,0,0,$counter-1)), "$i-monthly-payment");
        echo CHtml::textField("$i-monthly-payment",$model!=null?$model->amount:NULL,array('disabled'=>$disabled));
        echo ' '.CHtml::label("Date", "$i-monthly-date");
        echo CHtml::textField("$i-monthly-date",$model!=null?$model->date:null,array('disabled'=>$disabled));
        echo '</div>';
    }
    
    echo CHtml::endForm();
?>    
</div>
